<%@ page pageEncoding="utf-8" contentType="text/html" %>
<%@ page import="core.*, model.PaperLog" %>
<%@ include file="header.tpl.jsp"%>

<%
PaperLog[] logs = (PaperLog[]) request.getAttribute("paperlog[]");
int limit = (Integer) request.getAttribute("limit");
int curpage = (Integer) request.getAttribute("page");
int totalnum = (Integer) request.getAttribute("totalnum");
int rank = (curpage - 1) * limit + 1;
int pid = Tool.intval(request.getParameter("pid"));
%>
<div class="box list">
	<h2>Rank List</h2>
	
	<table>
		<thead>
			<tr><td>排名</td><td>试卷名</td><td>得分</td><td>用户名</td><td>答题时间</td></tr>
		</thead>
		<tbody>
		<%for(int i = 0; i < logs.length; i++){%>
			<tr>
				<td><%=(rank++)%></td>
				<td><a href="QuestionList?pid=<%=logs[i].getPid()%>"><%=logs[i].getTitle()%></a></td>
				<td><%=logs[i].getScore()%> / <%=logs[i].getTotalScore()%></td>
				<td><%=logs[i].getUsername()%></td>
				<td><%=logs[i].getDatelineString()%></td>
			</tr>
		<%}%>
		</tbody>
	</table>
</div>

<%=View.mpage(totalnum, curpage, limit, "RankList" + (pid > 0 ? "?pid=" + pid : ""))%>

<%@ include file="footer.tpl.jsp"%>